﻿using System.Xml.Linq;
using Microsoft.Xna.Framework.Content.Pipeline;
using Phoenix.Xna.Framework.Graphics;
using Phoenix.Xna.Framework.Serialization;

namespace Phoenix.Xna.Framework.ContentPipeline.EffectMaps
{
    /// <summary>
    /// Processes EffectMaps through the content pipeline.
    /// </summary>
    [ContentProcessor(DisplayName = "EffectMap Processor - Phoenix XNA Engine")]
    public class EffectMapProcessor : ContentProcessor<XElement, EffectMapContent>
    {
        /// <summary>
        /// Processes the data from the content pipeline.
        /// </summary>
        /// <param name="input">The serialized data from the content pipeline.</param>
        /// <param name="context">The context to apply to the input data.</param>
        /// <returns>Deserialized EffectMap contained in a EffectMapContent object.</returns>
        public override EffectMapContent Process(XElement input, ContentProcessorContext context)
        {
            return new EffectMapContent()
            {
                EffectMap = new Serializer().Deserialize<EffectMap>(input)
            };
        }
    }
}
